extends IBasicComponent


class_name IStateCondition
"""
状态检测切换
"""


## 满足条件后切换的状态
@export var next_state: FiniteState = null
## 挂载的状态机
@export var state_machine: FiniteStateMachine = null


func __check_exports() -> Dictionary:
    return IComponent.merge({
        "state_machine": IComponent.find_parent.bind(self, func(x): return x is FiniteStateMachine, state_machine),
    }, super.__check_exports())

## 状态进入时
func enter() -> void:
    is_enable = true

## 状态退出时
func exit() -> void:
    pass

## 状态迭代
func update(delta: float) -> void:
    pass

# 跳转状态
func jump() -> void:
    is_enable = false
    state_machine.switch_to(next_state)
